<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>备忘录</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="第五篇redis安装配置centOS下redis安装配置 Quick Start1.安装1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 $ cd /usr/local/src $ wget http://download.redis.io">
<meta property="og:type" content="article">
<meta property="og:title" content="备忘录">
<meta property="og:url" content="http://yoursite.com/2018/04/15/第五篇redis安装配置/index.html">
<meta property="og:site_name" content="备忘录">
<meta property="og:description" content="第五篇redis安装配置centOS下redis安装配置 Quick Start1.安装1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 $ cd /usr/local/src $ wget http://download.redis.io">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2018-04-15T08:50:06.067Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="备忘录">
<meta name="twitter:description" content="第五篇redis安装配置centOS下redis安装配置 Quick Start1.安装1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 $ cd /usr/local/src $ wget http://download.redis.io">
  
    <link rel="alternate" href="/atom.xml" title="备忘录" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">备忘录</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-第五篇redis安装配置" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/第五篇redis安装配置/" class="article-date">
  <time datetime="2018-04-15T08:16:55.851Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="第五篇redis安装配置"><a href="#第五篇redis安装配置" class="headerlink" title="第五篇redis安装配置"></a>第五篇redis安装配置</h2><p>centOS下redis安装配置</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="1-安装"><a href="#1-安装" class="headerlink" title="1.安装"></a>1.安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"> $ <span class="built_in">cd</span> /usr/<span class="built_in">local</span>/src</span><br><span class="line"> $ wget http://download.redis.io/releases/redis-3.2.8.tar.gz</span><br><span class="line"> $ tar xzf redis-3.2.8.tar.gz</span><br><span class="line"> $ <span class="built_in">cd</span> redis-3.2.8</span><br><span class="line"> 编译：</span><br><span class="line">先阅读README</span><br><span class="line"> To force compiling against libc malloc,use:</span><br><span class="line"> % make MALLOC=libc</span><br><span class="line"> To compile against jemalloc on Mac OS X systems,use:</span><br><span class="line"> % make MALLOC=jemalloc</span><br><span class="line">所以</span><br><span class="line">如果是linux系统 使用</span><br><span class="line"> $ make MALLOC=libc</span><br><span class="line"> 编译</span><br><span class="line"> 编译成功之后，运行 </span><br><span class="line"> $ make install</span><br><span class="line"> </span><br><span class="line"> 再看README 文件</span><br><span class="line"> In order to install Redis binaries into/usr/<span class="built_in">local</span>/bin just use:</span><br><span class="line"> % make install</span><br><span class="line"> You can use`make PREFIX=/some/other/directory install`<span class="keyword">if</span> you wish to use a</span><br><span class="line"> different destination.</span><br><span class="line"> Make install will just install binaries <span class="keyword">in</span> your system, but will not configure</span><br><span class="line"> init scripts and configuration files <span class="keyword">in</span> the appropriate place.</span><br><span class="line"> </span><br><span class="line"> 当安装完毕之后，只生成了4个可执行的二进制文件</span><br><span class="line"> </span><br><span class="line">  [root@localhost bin]<span class="comment"># pwd</span></span><br><span class="line">  /usr/<span class="built_in">local</span>/bin</span><br><span class="line">  [root@localhost bin]<span class="comment"># ll</span></span><br><span class="line">  total 6880</span><br><span class="line">  -rwxr-xr-x.1 root root 337792Mar809:32 redis-benchmark</span><br><span class="line">  -rwxr-xr-x.1 root root 25176Mar809:32 redis-check-aof</span><br><span class="line">  -rwxr-xr-x.1 root root 3091736Mar809:32 redis-check-rdb</span><br><span class="line">  -rwxr-xr-x.1 root root 490832Mar809:32 redis-cli 客户端</span><br><span class="line">  lrwxrwxrwx.1 root root 12Mar809:32 redis-sentinel -&gt; redis-server</span><br><span class="line"> -rwxr-xr-x.1 root root 3091736Mar809:32 redis-server 服务端</span><br><span class="line"> </span><br><span class="line"> 为了正常使用，还必须进行下一步操作：</span><br><span class="line"> </span><br><span class="line"><span class="keyword">if</span> you are installing</span><br><span class="line"> it the proper way <span class="keyword">for</span> a production system, we have a script doing this</span><br><span class="line"> forUbuntuandDebian systems:</span><br><span class="line"> % <span class="built_in">cd</span> utils</span><br><span class="line"> %./install_server.sh</span><br><span class="line"> The script will ask you a few questions and will setup everything you need</span><br><span class="line"> to run Redis properly as a background daemon that will start again on</span><br><span class="line"> system reboots.</span><br><span class="line"> 一路下一步，安装完成后，产生以下文件</span><br><span class="line"> Selected config:</span><br><span class="line"> Port           :6379</span><br><span class="line"> Config file    :/etc/redis/6379.conf</span><br><span class="line"> Log file       :/var/<span class="built_in">log</span>/redis_6379.log</span><br><span class="line"> Data dir       :/var/lib/redis/6379</span><br><span class="line"> Executable     :/usr/<span class="built_in">local</span>/bin/redis-server</span><br><span class="line"> CliExecutable:/usr/<span class="built_in">local</span>/bin/redis-cli</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="2-客户端测试"><a href="#2-客户端测试" class="headerlink" title="2.客户端测试"></a>2.客户端测试</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">开启服务</span><br><span class="line"> [root@localhost bin]<span class="comment"># pwd</span></span><br><span class="line"> /usr/<span class="built_in">local</span>/bin</span><br><span class="line"> [root@localhost bin]<span class="comment">#./redis-server</span></span><br><span class="line"> 或者是</span><br><span class="line"> ./redis-server /etc/redis/6379.conf （对应的配置文件）</span><br><span class="line"> 进入客户端</span><br><span class="line"> </span><br><span class="line">[root@localhost bin]<span class="comment">#./redis-cli</span></span><br><span class="line"> 127.0.0.1:6379&gt;<span class="built_in">set</span> key1 aa</span><br><span class="line"> OK</span><br><span class="line"> 127.0.0.1:6379&gt;get key1</span><br><span class="line"><span class="string">"aa"</span></span><br><span class="line"> 127.0.0.1:6379&gt;<span class="built_in">exit</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/第五篇redis安装配置/" data-id="cjg0knacf0000vsom83qvgwwj" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
  
    <a href="/2018/04/15/第四篇FTP的安装配置/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title"></div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">April 2018</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/04/15/第五篇redis安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第四篇FTP的安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第三篇tomcat的安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第二篇JDK的安装/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/hello-world/">Hello World</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>